#ifndef GAMEWIDGET_H
#define GAMEWIDGET_H

#include<QWidget>
#include<QIcon>
#include<QPalette>
#include<QBrush>
#include<QPixmap>
#include<QPushButton>
#include<QMessageBox>
#include<QPaintEvent>
#include<QPainter>
#include<QLabel>
#include<QTimer>
#include<QTime>
#include<ctime>
#include<QButtonGroup>
#include<QKeyEvent>
#define longnumber 20
#define widthnumber 16

class Gamewidget : public QWidget
 {
    Q_OBJECT
public:
    explicit Gamewidget(QWidget *parent=0);
    void paintEvent(QPaintEvent*);
    void keyPressEvent(QKeyEvent*e);
    QPushButton *upPush;
    QPushButton *downPush;
    QPushButton *leftPush;
    QPushButton *rightPush;
    QPushButton *StartPush;
    QPushButton *ExitPush;
    QLabel *ScoreLabel;
    QLabel *LevelLabel;
    QLabel *ScoreLabelNumber;
    QLabel *LevelLabelNumber;
    QTimer *Timer;
    int snake[200][2];
    int snake1[200][2];
    static int m_setDiretion;
    QButtonGroup *buttonGroup;
    int foodx;
    int foody;
    int bodycount;
    bool Nobite;
    int Score;
    int Difficulty;
private:
    QPalette *palette;
    
signals:
    
public slots:
    void M_timeout();
    void M_startPush();
    void M_setDiretion(int index);
    void M_exitPush();
    void M_pausePush();
    void M_CheckGameOver();
};

#endif // GAMEWIDGET_H
